package cn.aitrox.ry.service.image.dao.impl;

import cn.aitrox.ry.common.dao.MapperSqlCallback;
import cn.aitrox.ry.common.dao.impl.BaseDaoImpl;
import cn.aitrox.ry.service.image.dao.ImageTransferItemDao;
import cn.aitrox.ry.service.image.entity.ImageTransferItemEntity;
import cn.aitrox.ry.service.image.mapper.ImageTransferItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ImageTransferDaoImpl extends BaseDaoImpl<ImageTransferItemEntity> implements ImageTransferItemDao {

    @Autowired
    private ImageTransferItemMapper mapper;

    @Override
    public void batchSave(List<ImageTransferItemEntity> list) {
        super.batchInsert(list, 2000, new MapperSqlCallback<ImageTransferItemEntity>() {
            @Override
            public void batchInsert(List<ImageTransferItemEntity> objList) {
                mapper.batchInsert(objList);
            }
        });
    }

    @Override
    public List<ImageTransferItemEntity> queryBySeries(String transferId, Integer relationType, String mode, List<String> seriesUids) {
        return mapper.queryBySeries(transferId, relationType, mode, seriesUids);
    }
}
